<template>
    <div>
        <c-header left-text="返回" title="服务反馈"></c-header>
        <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
            <van-cell-group>
                <van-cell v-for="item in services" :key="item.id" :title="item.title" :value="item.dealStatus===0?'未解决':'已解决'" :value-class="item.dealStatus===0?'danger':'success'" :label="item.content" />
            </van-cell-group>
        </van-list>
    </div>
</template>

<script>
import api from "../../api";
export default {
    name: "service.list",
    data() {
        return {
            pageInfo: {
                currentPage: 1,
                pageSize: 10,
            },
            total: 0,
            services: [],
            loading: false,
            finished: false,
        };
    },
    mounted() {
        this.getService();
    },
    methods: {
        // 获取通报
        async getService() {
            const response = await api.notice.getFeedbackPage({
                type: 0,
                ...this.pageInfo,
            });
            this.services = response.data.data.records || [];
        },
        onLoad() {
            this.pageInfo.pageSize += 10;
            this.getService();
            if (this.services.length >= this.total) {
                this.finished = true;
            }
        },
    },
};
</script>

<style lang='less' scoped>
.danger {
    color: tomato;
}
.success {
    color: yellowgreen;
}
</style>